<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:th='http://www.thymeleaf.org'>

<head>
	<meta charset='UTF-8'/>
	<link rel='stylesheet' type='text/css' href='themes/material/easyui.css'/>
	<link rel='stylesheet' type='text/css' href='themes/icon.css'/>
	<link rel='stylesheet' type='text/css' href='css/style.css'/>
</head>

<body>
	<div id='toolbar' class='top'><ul style='padding-left:5px'><li th:each='btn:${btnlist}'>
		<a href='#' class='easyui-linkbutton' plain='true' onclick='' th:attrappend='onclick=${btn.btnfunc}'>
		<i class='fa fa-' th:attrappend='class=${btn.btnicon}'></i>&nbsp;<span th:text='${btn.btnname}'></span></a></li></ul>
	</div>
	<div id='searchTerm' style='display:none;'><ul>
		<li><label>菜单ID</label><input class='easyui-textbox' id='mid' th:value='${menuid}'/></li></ul>
	</div>
	<div id='common-dialog' class='easyui-dialog' modal='true' closed='true' style='display:none;width:325px;height:370px'>
		<div class='easyui-layout' fit='true'>
			<form id='common-form' class='easyui-form' method='post'>
				<input type='hidden' name='id'/>
				<input type='hidden' name='menuid' id='bookid'/>
				<div region='center' border='false'>
				<div class='centerdiv'>
				<table>
					<tr><td><label>按钮名称：</label>
					<input class='easyui-textbox' name='btnname' data-options='required:true'/></td></tr>
					<tr><td><label>图标样式：</label>
					<input class='easyui-textbox' name='btnicon' data-options='required:true'/></td></tr>
					<tr><td><label>按钮方法：</label>
					<input class='easyui-textbox' name='btnfunc' data-options='required:true'/></td></tr>
					<tr><td><label>是否显示：</label>
					<select class="easyui-combobox" name="btnshow" data-options="required:true,editable:false">
				    <option value="0">是</option><option value="1">否</option></select></td></tr>
					<tr><td><label>展现顺序：</label>
					<input class='easyui-numberbox' name='btnorder' data-options='required:true'/></td></tr>
				</table></div></div>
				<div region='south' border='false' class='southdiv'>
				<a class='easyui-linkbutton' icon='fa fa-check-square-o' href='#' onclick="common_submit(-1,'',0)">保存</a>
				<a class='easyui-linkbutton' icon='fa fa-undo' href='#' onclick='common_reset()'>重置</a>
	</div></form></div></div>
	<table id='common-table'></table>
	<script type='text/javascript' src='jquery.min.js'></script>
	<script type='text/javascript' src='jquery.easyui.min.js'></script>
	<script type='text/javascript' src='js/util.js'></script>
	<script>
		$(function(){
			$('#common-table').datagrid({
				border:false,
				rownumbers: true,
				fitColumns: true,
				fit:true,
				url: '/d/menubtnlist',
				method: 'post',
				queryParams:{menuid: $('#mid').textbox('getValue')},
				striped : true,
				pagination:true,
				pageSize:25,
				pageList:[25,50],
				toolbar:'#toolbar',
				columns:[[
					{title:'选择',field:'id',checkbox:true},
					{title:'按钮名称',field:'btnname',align:'center',width:100},
					{title:'图标样式',field:'btnicon',align:'center',width:100},
					{title:'按钮方法',field:'btnfunc',align:'center',width:100},
					{title:'是否显示',field:'btnshow',align:'center',width:100,
						formatter: function(value,row,index){
							if(value == 0)
								return '是';
							if(value == 1)
								return '否';
						}
					},
					{title:'展现顺序',field:'btnorder',align:'center',width:100},
				]]
			})
		});
		function add(){
			$('#bookid').val($('#mid').textbox('getValue'));
			common_add('新增','/d/menubtnsave');
		}
		function edit(){
			common_edit('编辑','/d/menubtnedit');
		}
		function del(){
			common_delete('/d/menubtndel',-1,'',0);
		}
	</script>
</body>
</html>
